<template>
  <div>
    <Spin :spinning="exportLoading" tip="Loading...">
      <FilterTables
        ref="table"
        :columns="columns"
        height="300"
        :isSelectColumn="false"
        :isToperInfo="false"
        :isColumnFilter="false"
        :dataSource="tableList"
        :datakey="'records'"
        :onColumnsChange="(columns) => (this.columns = columns)"
      >
      </FilterTables>
    </Spin>
    <div style="height: 20px"></div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right',
      }"
    >
      <el-button @click="closeDrawer(1)">关 闭</el-button>
    </div>
  </div>
</template>
<script>
import { findById } from '@/api/omFinanceP/RebateManage/RebatePoolQuery';
import { dictionary } from '@/utils/dictMixin';
export default {
  data() {
    return {
      columns: this.createdTable(),
      tableList: [],
      exportLoading: false,
    };
  },
  created() {
    this.getDetailInfo();
  },
  mounted() {
    this.table = this.$refs.table.$refs.pageTable;
  },
  mixins: [dictionary],
  props: ['rowData'],
  methods: {
    async closeDrawer(type) {
      this.$emit('close');
    },
    async getDetailInfo() {
      this.exportLoading = true;
      const res = await findById(this.rowData);
      this.exportLoading = false;
      if (res.resultCode == 200) {
        this.tableList = res.data;
      }
    },
    createdTable() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        {
          title: '经销商代码',
          width: 150,
          dataIndex: 'dealerCode',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '经销商简称',
          dataIndex: 'dealerShortName',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '预扣金额',
          dataIndex: 'frostAmount',
          sorter: true,
          filter: true,
          filterType: 'input',
          precision: 2,
          numberFormat: true,
          align: 'right',
        },
        {
          title: '结算订单编号',
          width: 180,
          dataIndex: 'doNo',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '物料编码',
          width: 180,
          dataIndex: 'productCode',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '物料描述',
          dataIndex: 'productName',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '预扣时间',
          dataIndex: 'createdAt',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '预扣人',
          dataIndex: 'createdBy',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
      ];
    },
  },
};
</script>
